package com.kgc.onlineLife.service.impl;

import com.kgc.onlineLife.bean.Review;
import com.kgc.onlineLife.mapper.ReviewMapper;
import com.kgc.onlineLife.service.ReviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created On : 2022/4/16.
 * <p>
 * Author     : 张冲
 * <p>
 * Description: ReviewServiceImpl
 */
@Service
public class ReviewServiceImpl implements ReviewService {

    @Autowired
    private ReviewMapper reviewMapper;

    @Override
    public List<Review> getReviewListByPid(Integer pid) {
        return reviewMapper.selectReview(pid);
    }

    /**
    * @author: HarryXzy
    * @date: 2022/4/21 11:33 上午
    * @return:
    * @description: 添加评论
    **/
    @Override
    public void addReview(Review review) {
        reviewMapper.insertReview(review);
    }


    /**
     * @author : wangzhonguyu
     * @date   : 2022/4/21
     * @param  :
     * @return :
     * @description :
     */
    @Override
    public List<Review> queryReview() {
        return reviewMapper.selectReviewss();
    }

    @Override
    public boolean delReview(Integer id) {
        return reviewMapper.deleteReview(id)>0;
    }

    @Override
    public List<Review> queryReview(String cname) {
        System.out.println(reviewMapper.selectReviews(cname) + "查询结果------");
        return reviewMapper.selectReviews(cname);
    }
}
